package com.blb.community.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.blb.community.converter.BusinessTypeConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 操作日志记录
 * </p>
 *
 * @author 帅帅
 * @since 2022-07-02
 */
@TableName("sys_oper_log")
@ApiModel(value = "SysOperLog对象", description = "操作日志记录")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SysOperLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("日志主键")
    @ExcelProperty("编号")
    @TableId(value = "oper_id", type = IdType.AUTO)
    private Long operId;

    @ApiModelProperty("模块标题")
    @ExcelProperty("模块标题")
    private String title;

    @ApiModelProperty("业务类型（0其它 1新增 2修改 3删除）")
    @ExcelProperty(value = "业务类型", converter = BusinessTypeConverter.class)
    private Integer businessType;

    @ApiModelProperty("方法名称")
    @ExcelIgnore
    private String method;

    @ApiModelProperty("请求方式")
    @ExcelProperty("请求方式")
    private String requestMethod;

    @ApiModelProperty("操作类别（0其它 1后台用户 2手机端用户）")
    @ExcelIgnore
    private Integer operatorType;

    @ApiModelProperty("操作人员")
    @ExcelProperty("操作人员")
    private String operName;

    @ApiModelProperty("部门名称")
    @ExcelIgnore
    private String deptName;

    @ApiModelProperty("请求URL")
    @ExcelIgnore
    private String operUrl;

    @ApiModelProperty("主机地址")
    @ExcelProperty("主机地址")
    private String operIp;

    @ApiModelProperty("操作地点")
    @ExcelProperty("操作地点")
    private String operLocation;

    @ApiModelProperty("请求参数")
    @ExcelIgnore
    private String operParam;

    @ApiModelProperty("返回参数")
    @ExcelIgnore
    private String jsonResult;

    @ApiModelProperty("操作状态（0正常 1异常）")
    @ExcelProperty("操作状态")
    private Integer status;

    @ApiModelProperty("错误消息")
    @ExcelIgnore
    private String errorMsg;

    @ApiModelProperty("操作时间")
    @ExcelProperty("操作时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime operTime;

    @TableLogic
    @ExcelIgnore
    private Long delFlag;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelIgnore
    private LocalDateTime beginTime;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelIgnore
    private LocalDateTime endTime;
}
